<?php

/**
 * Description of SidebarRecent
 *
 * @author LongLT
 */
Yii::import('application.models.Announcement');
Yii::import('application.models.AnnouncementAssign');
class SidebarRecent extends CWidget {

    public function run() {
    	// Get top 10 post
    	//$announcement	= Announcement::model()->findAll(array('select' => 'title, id', 'condition' => 'status = 1', 'order' => 'created DESC', 'limit' => 10));
		// Get new invite
    	$eventInvite		= null;
    	$announcement		= null;
    	if (!Yii::app()->user->isGuest) {
    		$announcement	= AnnouncementAssign::model()->getAsignNew(Yii::app()->user->id);
    		$eventInvite	= AnnouncementAssign::model()->getAsignNew(Yii::app()->user->id, 1);
    	}
        $this->render('SidebarRecent', compact('announcement', 'eventInvite'));
    }

}
